<form action="<?php e_page("refund","index")?> " method="get">
    <fieldset>
        <legend></legend>
        <label for="real_name">用户名</label><br/>
        <input type="text" id="real_name" name="real_name" placeholder="请输入用户名"><br/>
        <label for="username">联系方式</label><br/>
        <input type="text" id="username" name="username" placeholder="请输入用户联系方式">
<!--        <label for="goods_name">商品名</label><br/>-->
<!--        <input type="text" id="goods_name" name="goods_name" placeholder="请输入商品名">-->

        <input type="submit" value="搜索">
    </fieldset>
</form>

<?php if(empty($r['refund'])){ echo "亲，暂时还没有退货信息哦~"?>
<?php }else{?>
<form>
    <fieldset>
        <legend></legend>
        <table id="dataTable">
            <thead>
            <tr>
                <th>ID</th>
                <th>商品名称</th>
                <th>用户手机号</th>
                <th>用户姓名</th>
                <th>金额</th>
<!--                <th>退货原因</th>-->
<!--                <th>商品描述</th>-->
                <th>退货类型</th>
<!--                <th>货款是否分配完</th>-->
                <th>当前状态</th>
                <th>申请时间</th>
                <th>退款时间</th>
                <th>操作</th>
<!--                <th>操作</th>-->
            </tr>
            </thead>
            <tbody>
            <?php foreach($r['refund'] as $v){?>
                <tr>
                    <td><?php echo $v['id']?></td>
                    <td><?php echo $v['order_id']?></td>
                    <td><?php echo $r[$v['user_id']]['username'];?></td>
                    <td><?php echo $r[$v['user_id']]['real_name'];?></td>
                    <td>￥<?php echo $v['money']?></td>
<!--                    <td>--><?php //echo $v['reason']?><!--</td>-->
<!--                    <td>--><?php //echo $v['description']?><!--</td>-->
                    <td><?php foreach($r['refundType'] as $k=>$s){?>
                            <?php if($k==$v['type']) echo $s?>
                        <?php } ?></td>
<!--                    <td>--><?php //foreach($r['moneyState'] as $k=>$s){?>
<!--                            --><?php //if($k==$v['allocate']) echo $s?>
<!--                        --><?php //} ?><!--</td>-->
                    <td><?php foreach($r['currentState'] as $k=>$s){?>
                            <?php if($k==$v['state']) echo $s?>
                        <?php } ?></td>
                    <td><?php echo $v['create_time']?></td>
                    <td><?php echo $v['confirm_time']?></td>

                    <!--                    <td>--><?php //if($v['state']=='apply'){ echo "已同意退款";}else{?><!--<a href="--><?php //e_action("apply","id={$v['id']}");?><!--">同意退款</a>--><?php //} ?><!----><?php //if($v['type']==1){?><!--/--><?php //if($v['state']=='confrim'){ echo "已确认收货并退款";}else{?><!--<a href="--><?php //e_action("confirm","id={$v['id']}");?><!--">确认收货且退款</a>--><?php //}?><!----><?php //}?><!--</td>-->
<!--                    <td><a href="--><?php //e_action("confirm","id={$v['id']}");?><!--">确认收货且退款</a></td>-->
                    <td>
                        <?php if($v['type']!=1){
                            switch($v['state']){
                                case 'create' : ?><a href="<?php e_action("applyWithGoods","id={$v['id']}");?>">同意退款申请</a><?php break;
                                case 'apply'  : ?>等待用户发货<?php break;
                                case 'shipped': ?><a href="<?php e_action("confirm","id={$v['id']}");?>">确认收货且退款</a><?php break;
                                case 'confirm': ?>已收货并退款<?php break;
                            }
                        }else{
                            switch($v['state']){
                                case 'create' : ?><a href="<?php e_action("apply","id={$v['id']}");?>">同意退款申请</a><?php break;
                                case 'confirm': ?>已退款<?php break;
                            }
                        }?>
                  </td>
              </tr>
            <?php }?>
            </tbody>
        </table>
    </fieldset>
</form>
<?php
/** @var Page $page */
$page=$r['pages'];
?>
<?php echo $page->getPageHtml(); ?>
<?php }?>
